package com.sy.service.impl;

import com.sy.entity.ClassName;
import com.sy.exception.BusinessException;
import com.sy.mapper.ClassMapper;
import com.sy.service.ClassService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author:范富强
 * @Date: 2021/10/12 0012 19:13
 */

@Service
public class ClassServiceImpl implements ClassService {
    @Autowired
    private ClassMapper classMapper;
    @Override
    public List<ClassName> getAllClass() {
        return classMapper.getAllClass();
    }

    @Override
    public List<String> getAllClassName() {
        List<String> allClassName = classMapper.getAllClassName();
        if (allClassName.isEmpty()){
            throw new BusinessException(HttpStatus.NOT_FOUND, "班级信息不存在");
        }
        return allClassName;
    }
}
